<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, index) in totalNum" :key="item">
        <van-grid :column-num="5">
          <van-grid-item 
          v-for="(value,i) in 10" :key="value"
          :icon="list[index*10+i]?list[index*10+i].img:''"
          :text="list[index*10+i]?list[index*10+i].text:''"
          />
        </van-grid>
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
    value:2,
      list: [],
      totalNum: 0,
    };
  },
  mounted() {
    axios.get("/list").then((res) => {
      this.list = res.data;
      this.totalNum = Math.ceil(res.data.length / 10);
    });
  },
};
</script>

<style>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
</style>